'use strict';

/* Filters */
// need load the moment.js to use this filter.
app.filter('fromNow', function () {
    return function (date) {
        return moment(date).fromNow();
    }
});

app.filter('workReportType', function () {
    return function (type) {
        debugger;
        return type == 1 ? "常规任务" : "临时任务";
    }
});
app.filter('money', function () {
    return function (amount) {
        return amount / 10.0;
    }
});

app.filter('sex', function () {
    return function (sex) {
        return sex == 0 ? "男" : "女";
    }
});
app.filter('performanceResult', function () {
    return function (result) {
        return result ? result : "未完成";
    }
});

app.filter('cyclicity', function () {
    return function (cyclicity) {
        if(cyclicity == 1){
            return "周";
        } else if(cyclicity == 1){
            return "月";
        } else if(cyclicity == 1){
            return "季度";
        } else if(cyclicity == 1){
            return "半年";
        } else if(cyclicity == 1){
            return "年";
        }
        return "不定时";
    }
});

app.filter('person_select', function () {
    return function (person) {
        if (person) {
            return person.realName ;
        } else {
            return null;
        }
    }
});

var workReportItemType=["文档框","单选框","多选框","图像","文件"];
app.filter("workReportItemType", function () {
    return function (type) {
        var t=parseInt(type);
        return workReportItemType[t];
    }
});


app.filter("workType", function () {
    return function (type) {
        switch (type) {
            case 0:
                return "常规任务";
            case 1:
                return "临时任务";
        }
    }
});

var workCycle=['每天','每周','每月','自定义'];
app.filter("workCycle", function () {
    return function (type) {
        return workCycle[type];
    }
});

app.filter('pointType', function () {
    return function (type) {
        switch (type) {
            case 0:
                return "工作上报";
            case  1:
                return "捐款";
            case 2:
                return "党费缴纳";
        }
    }
});

var payType = ['微信支付', '支付宝', '易支付','线下支付'];
app.filter('payType', function () {
    return function (type) {
        return payType[type];
    }
});


app.filter('singInModel', function () {
    return function (m) {
        if(m==null){
            return "";
        }
        if(m==0){
            return "手机APP";
        }
        if(m==1){
            return "管理员代签";
        }
    }
});

var chineseNumber=["零","一","二","三"];
app.filter('orgLevel', function () {
    return function (lvl) {
        if(lvl>1){
            lvl=lvl-1
            return chineseNumber[lvl]+"级党组织";
        }

    }
});

app.filter('recordTimeType',function () {
    return function (orderStatus) {
        switch (orderStatus) {
            case 0:
                return "未领";
            case  1:
                return "已领";
            case 2:
                return "逾期";
        }
    }
});
app.filter('bankLevel',function () {
    return function (bankLevel) {
        switch (bankLevel) {
            case 0:
                return "系统管理员";
            case 1:
                return "网点管理员";
            case 2:
                return "网点营业员";
            case 3:
                return "系统操作员";
            case 4:
                return "人行管理员";
        }
    }
});

app.filter('getArea',function () {
    return function (area) {
        switch (area) {
            case  '1':
                return "月湖区";
            case  '2':
                return "贵溪市";
            case  '3':
                return "余江县";
        }
    }
})

